<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="geometry" content="diagram">
  <link rel="stylesheet" href="./assets/common.css">
    <link rel="stylesheet" href="./assets/info.css">
  <title>point_circle</title>
  <style>
	#map { position:absolute; top:0; bottom:0; width:100%; }
  .amap-maps {
     cursor: auto !important
  }
  </style>
</head>

<body>
<div id="map"></div>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const colorObj ={
  blue: ["#E8FCFF", "#CFF6FF", "#A1E9ff", "#65CEF7", "#3CB1F0", "#2894E0", "#1772c2", "#105CB3", "#0D408C", "#002466"],
  red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"].reverse(),
  orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"].reverse(),
  green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"].reverse(),
  yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"].reverse(),
  purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"].reverse()
}
 var mapinstance = new AMap.Map('map',{
    center: [ 120.19382669582967, 30.258134 ],
     viewMode: '3D',
  pitch: 0,
  zoom: 12,
  maxZoom:20,
  minZoom:0,
 });

const scene = new L7.Scene({
  id: 'map',
  mapStyle: 'dark', // 样式URL
  map:mapinstance,
  center: [ 120.19382669582967, 30.258134 ],
  pitch: 0,
  zoom: 12,
  maxZoom:20,
  minZoom:0,
});
window.scene = scene;
scene.on('loaded', () => {
  $.get('https://gw.alipayobjects.com/os/rmsportal/epnZEheZeDgsiSjSPcCv.json', data => {
    console.log(data);
    const circleLayer  = scene.PointLayer({
      zIndex: 0,
    })
    .source(data,{
       isCluster:true
    })
    .shape('circle')
    .size('point_count', [ 5, 40]) // default 1
    .active(false)
    .color('point_count',["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"])
    .style({
      stroke: 'rgb(255,255,255)',
      strokeWidth: 2,
      opacity: 1
    })
     .render();
   
   scene.PointLayer({
      zIndex: 5
    })
     .source(circleLayer.layerSource)
    .shape('point_count', 'text')
    .size('point_count', [ 10, 20, 24 ])
    .color('#FFF')
    .style({
      // fontFamily: 'Monaco, monospace', // 字体
      fontWeight: 200,
      textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
      textOffset: [ 0, 0 ], // 文本相对锚点的偏移量 [水平, 垂直]
      spacing: 2, // 字符间距
      padding: [ 4, 4 ], // 文本包围盒 padding [水平，垂直]，影响碰撞检测结果，避免相邻文本靠的太近
      stroke: 'white', // 描边颜色
      strokeWidth: 1, // 描边宽度
      opacity: 1.0
    })
    .render();
    
    setTimeout(()=>{
      scene.setMapStyle('grey');
    },2000)
  
 });
});
</script>
</body>
</html>

